import axios from "./axios.js";
// import { Underscore  } from "underscore";
// import _, { map } from 'underscore';
// console.log(_)
// console.log(axios)

// import * as $ from "jquery"
// console.log($)

//鼠标滑动，发送请求
var container = document.querySelector(".container")
container.onmousemove = function () {
  // console.log("heloo")
  axios({
    baseUrl: "http://websong.wang:4000",
    url: "/rl",
    data: {
      page: 1,
      size: 10
    }
  })
}

//点击按钮，发送请求
var button = document.querySelector("button")
var container = document.querySelector("#container")
button.onclick = async function () {
  var result = await axios({
    baseUrl: "http://websong.wang:4000",
    url: "/rl",
    method: "GET",
    data: {
      page: 1,
      number: 10
    }

  })
  var host = result.data.result.host;
  var list = result.data.result.list;
  var ul = document.createElement("ul")
  list.forEach(item => {
    var li = document.createElement("li")
    li.innerHTML = `
        <span> ${item.goods_name}</span>
        <img src="${host + item.icon}"></img>
    `
    ul.appendChild(li)
  });
  container.appendChild(ul)

}